package cn.javaweb.group0.servlet;

import cn.javaweb.group0.entity.Module;
import cn.javaweb.group0.model.ModuleModel;
import cn.javaweb.library.AjaxResult;
import cn.javaweb.library.Util;
import com.alibaba.fastjson2.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/module/add")
public class ModuleAddServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Module module = JSON.parseObject(Util.getJsonParam(req), Module.class);
        ModuleModel moduleModel = new ModuleModel();

        moduleModel.AddModule(module);
        resp.getWriter().print(AjaxResult.success("操作成功"));
    }
}
